#ifdef _MSC_VER
#pragma warning(disable:4244 4267 4355) // for google protobuf
#endif

#include "LBClient.h"
#include "PBDispatcher.h"
#include "PBCodec.h"
#include "loadBalance.pb.h"
#include "ClientBootstrap.h"

namespace dsth {

LBClient::LBClient(EventLoop* loop, const InetSocketAddress& addr, const char* name) 
    : client_(new ClientBootstrap(loop, addr, name)), 
    dispatcher_(new PBDispatcher()),
    codec_(new PBCodec(std::make_pair(dispatcher_.get(), &PBDispatcher::OnMessage),
        std::make_pair(this, &LBClient::OnErrorMsg)))
{

}

LBClient::~LBClient() {

}

void LBClient::Run() {
    client_->Connect();
}

void LBClient::OnConnect(Connection* conn) {
}

void LBClient::OnDisConnect(Connection* conn) {

}

void LBClient::OnErrorMsg(Connection* conn, ChannelBuffer* buffer, Timestamp time) {

}

} // namespace